package com.example.demo.service;

import com.example.demo.entity.ArticleInfo;
import com.example.demo.entity.VO.ArticleInfoVO;
import com.example.demo.mapper.ArticleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DELL
 * Date: 2023-06-06
 * Time: 17:13
 */
@Service
public class ArticleService {

    @Autowired
    private ArticleMapper articleMapper;

    public int addArticle(ArticleInfo articleInfo) {
        return articleMapper.addArticle(articleInfo);
    }

    public ArticleInfo getArticleByIdAndUid(Integer id, Integer uid) {
        return articleMapper.getArticleByIdAndUid(id, uid);
    }

    public int updateArticle(ArticleInfo articleInfo) {
        return articleMapper.updateArticle(articleInfo);
    }

    public ArticleInfoVO getDetailArticle(Integer id) {
        return articleMapper.getDetailArticle(id);
    }

    public int addvisits(Integer id) {
        return articleMapper.addvisits(id);
    }

    public List<ArticleInfo> countArticle(Integer uid) {
        return articleMapper.countArticle(uid);
    }

    public ArticleInfo selectArticleById(Integer id) {
        return articleMapper.selectArticleById(id);
    }

    public List<ArticleInfo> getAllArticle(Integer id) {
        return articleMapper.getAllArticle(id);
    }

    public int del(Integer id, Integer uid) {
        return articleMapper.del(id, uid);
    }

    public List<ArticleInfo> getAllArticleByPage(Integer pageSize, Integer offset, Integer state) {
        return articleMapper.getAllArticleByPage(pageSize, offset, state);
    }

    public List<ArticleInfo> getAllArticleByPageFromUser(Integer pageSize, Integer offset, Integer uid, Integer state) {
        return articleMapper.getAllArticleByPageFromUser(pageSize, offset, uid, state);
    }

    public int getArticle(Integer state) {
        return articleMapper.getArticle(state);
    }

    public int getArticleFromUser(Integer uid ,Integer state) {
        return articleMapper.getArticleFromUser(uid, state);
    }

    public ArticleInfoVO getImagePath(Integer id) {
        return articleMapper.getImagePath(id);
    }

    public int saveArticle(ArticleInfo articleInfo) {
        return articleMapper.saveArticle(articleInfo);
    }

    public List<ArticleInfo> getAllArticleByPageNotSub(Integer pageSize, Integer offset, Integer uid, Integer state) {
        return articleMapper.getAllArticleByPageNotSub(pageSize, offset, uid, state);
    }

    public int getArticleNotSub(Integer uid ,Integer state) {
        return articleMapper.getArticleNotSub(uid, state);
    }

    public int autoSaveArticle(ArticleInfo articleInfo) {
        return articleMapper.autoSaveArticle(articleInfo);
    }

 }
